package com.wangzh.network.tcp.test;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) throws IOException {
        //创建Socket对象并连接服务端
        Socket socket = new Socket("127.0.0.1", 10000);

        Scanner scanner = new Scanner(System.in);
        OutputStream os = socket.getOutputStream();

        while (true) {
            System.out.println("请输入您要发送的数据");
            String str = scanner.nextLine();
            if (str.equals("886")) {
                break;
            }
            os.write((str+"\n\r").getBytes());

        }

        socket.close();
    }
}
